package com.commerce.mapping;

import com.commerce.model.Menu;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.dao.DataAccessException;

import javax.xml.crypto.Data;
import java.util.List;

/**
 * @author wyj
 * @Title:
 * @Description:
 */
@Mapper
public interface MenuMapping {

    /**
     * 查询所有
     * @return
     * @throws DataAccessException
     */
    List<Menu> selectList()throws DataAccessException;

    /**
     * 查询所有一级菜单
     * @return
     * @throws DataAccessException
     */
    List<Menu> selectMainMenu()throws  DataAccessException;

    /**
     * 新增
     * @param menu
     * @return
     * @throws DataAccessException
     */
    int insert(Menu menu)throws  DataAccessException;

    /**
     * 修改
     * @param menu
     * @return
     * @throws DataAccessException
     */
    int update(Menu menu)throws  DataAccessException;

    /**
     * 删除
     * @param id
     * @return
     * @throws DataAccessException
     */
    int delete(int id)throws DataAccessException;

    /**
     * 根据Id查询
     * @param id
     * @return
     * @throws DataAccessException
     */
    Menu selectById(int id)throws DataAccessException;

    /**
     * 查询子菜单数量
     * @param p_id
     * @return
     * @throws DataAccessException
     */
    int selectPidCount(int p_id)throws  DataAccessException;

    /**
     * 根据IDS查询菜单
     * @param menu_ids
     * @return
     * @throws DataAccessException
     */
    List<Menu> selectMenuIdsMenu(String menu_ids)throws  DataAccessException;
}
